Developing a real estate advertisement module from scratch#1188
Developing a real estate advertisement module from scratch#1188pasaw-odoo wants to merge 8 commits intoodoo:19.0from
Conversation
b69f8cc to
540d490
Compare
Setup and install real estate module Declaring model class and creating estate property table in database via odoo orm implementing access rights
540d490 to
8b78ab6
Compare
-added default view (list and form) in chapter 5 with some field attributes -added custom view (list and form) in chapter 6
5bb84ef to
83d1383
Compare
-chapter 6 search view added
mash-odoo
left a comment
There was a problem hiding this comment.
Hello!
Great start to the task! 🐣
Here are some comments and suggestions, please have a look.
Also change the PR title and description!
estate/demo/demo.xml
Outdated
| @@ -0,0 +1,198 @@ | |||
| <odoo> | |||
| <data> | |||
There was a problem hiding this comment.
What's the purpose of this data tag?
Will there be any impact if we remove it?
There was a problem hiding this comment.
The tag was used in older Odoo versions and is now completely optional. But if we are using noupdate="1", the logic is — when a user renames a field and saves it in the DB, but the .xml file on disk doesn't change, then on upgrade the old data comes back from the XML. But with noupdate="1" it doesn't update and keeps what the user had renamed. And if we are writing inside the tag and want to apply noupdate="1" to all records we can put it directly on , but if we want to apply it to only a few records then we can add a separate block for those specific ones.
estate/demo/demo.xml
Outdated
| </record> | ||
|
|
||
| </data> | ||
| </odoo> No newline at end of file |
There was a problem hiding this comment.
Always leave an extra line at the end of the file.
| from dateutil.relativedelta import relativedelta | ||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class EstateProperty(models.Model): |
There was a problem hiding this comment.
Follow these guidelines to import in a correct order and proper format.
estate/models/estate_property.py
Outdated
| name = fields.Char(string='Property Name', required=True, help='Enter the name of the property') | ||
| description = fields.Text(string='Property Description', help='Enter a description of the property') |
There was a problem hiding this comment.
| name = fields.Char(string='Property Name', required=True, help='Enter the name of the property') | |
| description = fields.Text(string='Property Description', help='Enter a description of the property') | |
| name = fields.Char(string="Property Name", required=True, help='Enter the name of the property') | |
| description = fields.Text(string="Property Description", help='Enter a description of the property') |
Functional strings (the strings which are shown to user) should be in double quotes.
estate/models/estate_property.py
Outdated
|
|
||
| name = fields.Char(string='Property Name', required=True, help='Enter the name of the property') | ||
| description = fields.Text(string='Property Description', help='Enter a description of the property') | ||
| postcode = fields.Char(string='Postcode', help='Enter the postcode of the property') |
There was a problem hiding this comment.
| postcode = fields.Char(string='Postcode', help='Enter the postcode of the property') | |
| postcode = fields.Char(help='Enter the postcode of the property') |
Even if you don't mention string here, it will directly take the field name.
estate/models/estate_property.py
Outdated
| name = fields.Char(string='Property Name', required=True, help='Enter the name of the property') | ||
| description = fields.Text(string='Property Description', help='Enter a description of the property') | ||
| postcode = fields.Char(string='Postcode', help='Enter the postcode of the property') | ||
| date_availability = fields.Date(string='Availability Date', help='Enter the date when the property becomes available', copy=False, default=lambda self: fields.Date.today() + relativedelta(months=3)) |
There was a problem hiding this comment.
Nit: try to make it <100 for a better readability.
| date_availability = fields.Date(string='Availability Date', help='Enter the date when the property becomes available', copy=False, default=lambda self: fields.Date.today() + relativedelta(months=3)) | |
| date_availability = fields.Date( | |
| string='Availability Date', | |
| help='Enter the date when the property becomes available', | |
| copy=False, | |
| default=lambda self: fields.Date.today() + relativedelta(months=3) | |
| ) |
| selection=[ | ||
| ('north', 'North'), | ||
| ('south', 'South'), | ||
| ('east', 'East'), | ||
| ('west', 'West'), | ||
| ], |
There was a problem hiding this comment.
| selection=[ | |
| ('north', 'North'), | |
| ('south', 'South'), | |
| ('east', 'East'), | |
| ('west', 'West'), | |
| ], | |
| selection=[ | |
| ('north', "North"), | |
| ('south', "South"), | |
| ('east', "East"), | |
| ('west', "West"), | |
| ], |
keep the key in single quotes and value in double quotes
| </menuitem> | ||
|
|
||
| </menuitem> |
There was a problem hiding this comment.
| </menuitem> | |
| </menuitem> | |
| </menuitem> | |
| </menuitem> |
| <filter | ||
| name="available" | ||
| string="Available" | ||
| domain="['|', ('state', '=', 'new'), ('state', '=', 'offer_received')]" |
estate/__manifest__.py
Outdated
| 'demo/demo.xml', | ||
| ], | ||
| 'application': True, | ||
| 'installable': True, |
There was a problem hiding this comment.
What's the meaning of installable true?
There was a problem hiding this comment.
installable true means it becomes visible in all filter and we can install that specific module
There was a problem hiding this comment.
we dont need to write this as it is already true in default manifest which is in module.py
- Added new models: Property Type, Property Tag, and Property Offer. - Implemented relations: Many2one (Type, Buyer, Seller), Many2many (Tags), and One2many (Offers). - Added views (List, Form) for the new models. - Added 'image' field to Property form and module web icon.
cd3db74 to
cb8ff1b
Compare
- Added demo data for property types , property tags and enhanced search view
0d9d48c to
68a2994
Compare
- add total_area computed field (living_area + garden_area) - add best_price computed field (max of offer prices) - add onchange on garden field (auto-fill area and orientation) - add date_deadline computed field on estate.property.offer - add inverse on date_deadline to sync validity days
mash-odoo
left a comment
There was a problem hiding this comment.
Hello!
Thank you for your work..
Here are a few questions and suggestions.
| <field name="name">Gated Community</field> | ||
| </record> | ||
|
|
||
| </odoo> No newline at end of file |
There was a problem hiding this comment.
Always add an extra line at the end of the file!!
| string="Garden Orientation", | ||
| help='Select the orientation of the garden' | ||
| ) | ||
| active = fields.Boolean(string="Active", default=True, help='Set to False to archive the property') |
There was a problem hiding this comment.
| active = fields.Boolean(string="Active", default=True, help='Set to False to archive the property') | |
| active = fields.Boolean(default=True, help='Set to False to archive the property') |
No need to add the string. By default it will take the string from the field name
| ) | ||
| property_type_id = fields.Many2one('estate.property.type', string="Property Type") | ||
| buyer_id = fields.Many2one('res.partner', string="Buyer", copy=False) | ||
| seller_id = fields.Many2one('res.users', string="Salesperson", default=lambda self:self.env.user) |
There was a problem hiding this comment.
What is a lambda function? And why do we need to use this function here?
|
|
||
| class EstatePropertyOffer(models.Model): | ||
| _name = 'estate.property.offer' | ||
| _description = 'Estate Property Offer' |
There was a problem hiding this comment.
| _description = 'Estate Property Offer' | |
| _description = "Estate Property Offer" |
This will be displayed in UI so you can keep it in double quotes
| ('accepted', "Accepted"), | ||
| ('refused', "Refused"), | ||
| ], | ||
| string="Status", |
There was a problem hiding this comment.
| string="Status", |
You don't need to explicitly mention the string unless you want a different display name than the field name.
| <field name="name" optional="show"/> | ||
| <field name="property_type_id" optional="show"/> | ||
| <field name="postcode" optional="show"/> | ||
| <field name="tag_ids" widget="many2many_tags" optional="show"/> |
| <list limit="50" decoration-danger="state == 'canceled'" decoration-success="state == 'sold'"> | ||
| <field name="name" optional="show"/> | ||
| <field name="property_type_id" optional="show"/> | ||
| <field name="postcode" optional="show"/> |
There was a problem hiding this comment.
What is the purpose of this optional attribute?
| <filter | ||
| string="Available" | ||
| name="available" | ||
| domain="[('state','in',['new','offer_received'])]"/> |
There was a problem hiding this comment.
| domain="[('state','in',['new','offer_received'])]"/> | |
| domain="[('state', 'in', ['new', 'offer_received'])]"/> |
Leave an extra space after adding a comma.
| string="Archived" | ||
| name="archived" | ||
| domain="[('active','=',False)]"/> | ||
| <separator/> |
There was a problem hiding this comment.
Why do we use this separator?
Also do you know where is it coming from?
| 'views/estate_menus.xml', | ||
|
|
||
| ], |
There was a problem hiding this comment.
| 'views/estate_menus.xml', | |
| ], | |
| 'views/estate_menus.xml', | |
| ], |

Setup and install real estate module
Declaring model class and creating estate property table in database via odoo orm
implementing access rights